package com.lemon.equipment.exception;

import com.lemon.equipment.enums.BizCodeEnum;
import lombok.Data;

/**
 * 作者：朱骏杰
 * 时间：2024/7/30
 * 描述：
 */

@Data
public class BizException extends RuntimeException{
    private  Integer code;
    private String message;

    public static BizException of(Integer code,String message){
        BizException bizException = new BizException();
        bizException.setCode(code);
        bizException.setMessage(message);
        return  bizException;
    }
    public static BizException of(String message){
        BizException bizException = new BizException();
        bizException.setCode(BizCodeEnum.UNKNOWN_ERROR.getCode());
        bizException.setMessage(message);
        return  bizException;
    }
}
